import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Axios from 'axios'

import Vant from 'vant';
import 'vant/lib/index.css';

Vue.prototype.$axios=Axios
Vue.config.productionTip = false
Vue.use(Vant);
//请求拦截器
Axios.interceptors.request.use(config=>{
  // console.log(sessionStorage.getItem('token'))
  // 判断是否存在token，如果存在的话，则每个http header都加上token
  if(sessionStorage.getItem('token')){
    
    config.headers.common['Authorization']=sessionStorage.getItem('token')
  }
  return config
},error=>{
  return Promise.reject(error)
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
